]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Make sure the animation always starts from the first frame, even if the
authorDan Winship <danw@src.gnome.org>
Tue, 13 Jan 2009 20:49:31 +0000 (20:49 +0000)
committerDan Winship <danw@src.gnome.org>
Tue, 13 Jan 2009 20:49:31 +0000 (20:49 +0000)
system is really busy and ClutterTimeline doesn't get a chance to call
us until it thinks several frames have passed

svn path=/trunk/; revision=147

js/ui/main.js

index af535e314d3545568cfc973300fd6cdfb4f48c1b..b4e1fab62bd33c0d3934945c2e6ccf217cdeecec 100644 (file)
@@ -64,8 +64,18 @@ ClutterFrameTicker.prototype = {
         // So by dynamically adjusting the value of FRAME_RATE we can trick
         // it into dealing with dropped frames.
 
-        let delta = frame - this._frame;
-        if (delta == 0)
+        // If there is a lot of setup to start the animation, then
+        // first frame number we get from clutter might be a long ways
+        // into the animation (or the animation might even be done).
+        // That looks bad, so we always start one frame into the
+        // animation then only do frame dropping from there.
+        let delta;
+        if (this._frame == 0)
+            delta = 1;
+        else
+            delta = frame - this._frame;
+
+        if (delta == 0) // protect against divide-by-0 if we get a frame twice
             this.FRAME_RATE = this.TARGET_FRAME_RATE;
         else
             this.FRAME_RATE = this.TARGET_FRAME_RATE / delta;